import java.util.Scanner;

/**
 * @author gao
 * @date 2025/8/30 14:28
 */

public class Solution {
    public int countPrimes(int n) {
        if (n <= 2) {
            return 0;
        }

        // 假设所有数都是质数
        boolean[] isPrime = new boolean[n];
        for (int i = 2; i < n; i++) {
            isPrime[i] = true;
        }

        // 遍历sqrt(n)即可
        for (int i = 2; i * i < n; i++) {
            if (isPrime[i]) {
                // 将i的倍数标记为非质数
                for (int j = i * i; j < n; j += i) {
                    isPrime[j] = false;
                }
            }
        }
        int count = 0;
        for (int i = 2; i < n; i++) {
            if (isPrime[i]) {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            Solution solution = new Solution();
            System.out.println(solution.countPrimes(n));
        }
    }
}